package com.svse.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.svse.dao.ProductinfoDAO;
import com.svse.service.ProductinfoService;
import com.svse.vo.Productinfo;

@Service("productinfoService")
public class ProductinfoServiceImpl implements ProductinfoService {
	@Autowired
	private ProductinfoDAO productinfoDAO;
	
	public ProductinfoDAO getProductinfoDAO() {
		return productinfoDAO;
	}

	public void setProductinfoDAO(ProductinfoDAO productinfoDAO) {
		this.productinfoDAO = productinfoDAO;
	}

	public void addProductinfo(Productinfo productinfo) {
		productinfoDAO.save(productinfo);
	}

	public List<Productinfo> findAll() {
		return productinfoDAO.findAll();
	}

	public Productinfo findById(int productId) {
		return productinfoDAO.findById(productId);
	}

	public List<Productinfo> findAllByPage(int beginIndex, int maxLength) {
		return productinfoDAO.findAllByPage(beginIndex, maxLength);
	}

	public void delPro(int id) {
		productinfoDAO.delete(findById(id));
	}

}
